<%@ page import="pro.syg.JdbcUtils" %>
<%@ page import="pro.syg.pojo.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
<<<<<<< HEAD:web/ccy/user-edit.jsp
    String id = request.getParameter("id");
    User user = null;
    if (id!=null){
        String sql = "SELECT id,`name`,username FROM `user` WHERE id = ?";
        user = JdbcUtils.select(sql, User.class,id);
    }else {
        user = new User();
        user.setName("");
=======
    String id = request.getParameter("i");
    User user =null;
    if(id!=null){
        //当存在id的时候，查询数据库中的数据
        String sql="SELECT `name` ,username from `user` where id=?";
        user = JdbcUtils.select(sql, User.class, id);
    }else{
        //当不存在id，创建一个空的
        user =new User();
>>>>>>> 85187eec3314a1566584f1dfe608166ad15c6841:web/syg/user-edit.jsp
        user.setName("");
        user.setUsername("");
    }

%>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java实训团队协作简单案例 - 用户信息编辑页面</title>
    <link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/vendors/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/core.css" />
    <link rel="stylesheet" href="assets/css/index.css" />

    <link rel="stylesheet" href="assets/css/user.css" />
</head>

<body>
<jsp:include page="/WEB-INF/tpl/syg/header.jsp"/>
    <section class="container">
        <jsp:include page="/WEB-INF/tpl/syg/left.jsp"/>
        <div class="main-right">
            <h3>用户信息编辑页面</h3>
            <form action="/syguser/add">
                姓名：<input name="n" type="text" value="<%=user.getName()%>"/>
                账号：<input name="u" type="text" value="<%=user.getUsername()%>"/>
                <button>保存</button>
<<<<<<< HEAD:web/ccy/user-edit.jsp
                <input type="hidden" name="i" value="<%=user.getId()%>">
=======
                <input type="hidden" name="i" value="<%=id%>" />
>>>>>>> 85187eec3314a1566584f1dfe608166ad15c6841:web/syg/user-edit.jsp
            </form>
        </div>
    </section>
</body>

</html>